home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Leonardo the Inventor
/
Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso
/
LEOWINMV
/
DATABASE.DIR
/
00110_Script_Generate numPages-pictures in each topic
< prev
next >
Wrap
Text File
|
1996-03-28
|
3KB
|
103 lines
-- --------------------------------------------------------------
-- Handler generateNumPagesPerTopic puts info into the field
-- "numPages per Topic" which contains the number of pages in each
-- browserTopic.
-- NOTE: this handler assumes every topic has an article. Before this
-- handler is run, run checkArticleCasts first to get a list of all
-- topics that do not have articles. Correct those errors, and then
-- run this handler.
on generateNumPagesPerTopic numLinesPerBrowserTopic
if voidP(numLinesPerBrowserTopic) then
set numLinesPerBrowserTopic = 1
end if
set browserTopics = field "browserTopics"
set numLines = the number of lines in browserTopics
set numTopics = (numLines - (numLines/numLinesPerBrowserTopic -1)) / numLinesPerBrowserTopic
put EMPTY into field "numPages per Topic"
set curLine = 1
-- go through the browser topics one by one
repeat while (curLine <= numLines)
set curTopic = line curLine of browserTopics
set pageIndex = 1
put "checking" && curTopic
if (curTopic <> EMPTY) then
-- get num pages
set pageIndex = getNumPropertyGenerate(curTopic, "text")
put curTopic & ":" & string(pageIndex-1) & RETURN after field "numPages per Topic"
end if -- curTopic <> EMPTY
set curLine = getNextTopicStartLine(curLine, numLinesPerBrowserTopic)
end repeat -- going through the topics
end
-- --------------------------------------------------------------
-- Handler getNumPropertyGenerate
on getNumPropertyGenerate whichTopic, type
set index = 1
set continue = TRUE
repeat while continue
set articleCast = the number of cast (whichTopic && type & string(index))
if (articleCast = -1) then
set continue = FALSE
return index
else
set index = index + 1
end if
end repeat
end
-- --------------------------------------------------------------
-- Handler generateNumPicturesPerTopic puts info into the field
-- "numPictures per Topic" which contains the number of pictures in each
-- browserTopic..
on generateNumPicturesPerTopic numLinesPerBrowserTopic
if voidP(numLinesPerBrowserTopic) then
set numLinesPerBrowserTopic = 1
end if
set browserTopics = field "browserTopics"
set numLines = the number of lines in browserTopics
set numTopics = (numLines - (numLines/numLinesPerBrowserTopic -1)) / numLinesPerBrowserTopic
put EMPTY into field "numPictures per Topic"
set curLine = 1
-- go through the browser topics one by one
repeat while (curLine <= numLines)
set curTopic = line curLine of browserTopics
set index = 1
put "checking" && curTopic
if (curTopic <> EMPTY) then
-- get num pages
set index = getNumPropertyGenerate(curTopic, "picture")
put curTopic & ":" & string(index-1) & RETURN after field "numPictures per Topic"
end if -- curTopic <> EMPTY
set curLine = getNextTopicStartLine(curLine, numLinesPerBrowserTopic)
end repeat -- going through the topics
end
on generateAll
setUpCastNumbersFields
generateNumPagesPerTopic(1)
generateNumPicturesPerTopic(1)
saveMovie
quit
end